-- @owner: zou_jialiang050
-- @date: 2024-15-06
-- @testpoint: 使用函数创建系统视图

--step1:建表;expect:成功
drop sequence if exists seq_ustore_regr_slope_028;
create sequence seq_ustore_regr_slope_028 increment by 1 start with 10;
drop table if exists t_ustore_regr_slope_028 cascade;
create table t_ustore_regr_slope_028(
     col_1 integer,
     col_2 number(19,0),
     col_3 number(10,6)
) with (storage_type=ustore);

begin
	for i in 1..50 loop
      insert into t_ustore_regr_slope_028 values(
	  i,
      seq_ustore_regr_slope_028.nextval,
	  i+445.255
	  );
    end loop;
end;
/

--step2:使用函数创建系统视图;expect:成功
drop view if exists view_ustore_regr_slope_028;
create view view_ustore_regr_slope_028 as select REGR_SLOPE(COL_1,COL_2) from t_ustore_regr_slope_028;
select * from view_ustore_regr_slope_028;


--step3:清理环境;expect:成功
drop sequence if exists seq_ustore_regr_slope_028 cascade;
drop view if exists view_ustore_regr_slope_028 cascade;
drop table if exists t_ustore_regr_slope_028 cascade;